Closed Bug 1007049 Opened 11 years ago Closed 9 years ago

Clang Static Analysis: Remove never read value to fix a minor warning found by scan-build.

Categories

(NSS :: Libraries, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED DUPLICATE of bug 1182667

People

(Reporter: sblin, Unassigned)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

+++ This bug was initially created as a clone of Bug #1005652 +++ The attached patch fixes a warning detected by scan-build, the clang static analyzer.
Attachment #8418636 - Flags: review?(kaie)
Attachment #8418636 - Flags: review?(wtc)
Comment on attachment 8418636 [details] [diff] [review] nss-minor-fix.diff Thank you for the patch. This patch is wrong because the two PK11_MakeString calls have side effect. If the first argument is NULL and the second argument is not NULL, PK11_MakeString copies the third argument to the second argument and returns the second argument: http://mxr.mozilla.org/nss/ident?i=PK11_MakeString There are two ways to fix this. 1. Check that |tmp| is not NULL. As I explained above, this check will never fail, so it is a useless check. 2. Ignore the return value of these two PK11_MakeString calls. You can add a (void) cast to make the intention clear: (void)PK11_MakeString(NULL,slot->slot_name, ...
Attachment #8418636 - Flags: review?(wtc)
Attachment #8418636 - Flags: review?(kaie)
Attachment #8418636 - Flags: review-
Oops, sorry I forget the bug. Thank you for the commentary. I will work on it.
Status: UNCONFIRMED → NEW
Ever confirmed: true
Looks like this was fixed as part of Bug 1182667: https://hg.mozilla.org/projects/nss/diff/0a59f0bce2ea/lib/pk11wrap/pk11slot.c#l1.33 Thanks for the patch anyways.
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: